 <?php echo validation_errors(); ?> <?php echo form_open('services/searchticket'); ?>
 <div id="searchTicket">
 <table>
	<tr>
		<td><?php echo $this->lang->line('ticket_number');?></td>
		<td><input id="tags" style="border:1px solid #BBB; color:#444444; background:#FFF;" type="text" name="ticket" value="<?php echo set_value('ticket'); ?>" size="20"></td>
	</tr>
	<tr>
		<td><?php echo $this->lang->line('surname');?></td>	
		<td><input id="tags2" style="border:1px solid #BBB; color:#444444; background:#FFF;" type="text" name="surname" value="<?php echo set_value('surname'); ?>" size="20"></td>
	</tr>
	<tr>
		<td colspan="2" align="right"><button value="<?php echo $this->lang->line('view_ticket');?>" type="submit" width="100%"><?php echo $this->lang->line('view_ticket');?></button></td>
	</tr>
</table><br>

<div>
  <?php 
      if (isset($ticket_xml)){ 
      	$exception = $ticket_xml->xpath('//Exception');
		if (count($exception) > 0) {
			echo '<pre>ERROR OCCURED<BR>-------------';
			echo '<BR>Code       :' . $exception[0]->code;
			echo '<BR>Descriptino:' . $exception[0]->description;
			echo '<BR>Detail     :' . $exception[0]->details;
			echo '</pre>';
		} else {
      	?><br>
      
        <div id="passengers" class="passengers">
		<h5><?php echo $this->lang->line('pnr');?>:<?php $val = $ticket_xml->xpath('//CONFNO'); echo $val[0];?></h5><br>
		<div class="showBox">
		<h5><?php echo $this->lang->line('pax');?></h5><br>
		<table id="itinirary">
			<thead>
				<tr>
					<th align="left" width="70"><?php echo $this->lang->line('title');?></th>
					<th align="left" width="70"><?php echo $this->lang->line('name');?></th>
					<th align="left" width="70"><?php echo $this->lang->line('surname');?></th>
				</tr>
			</thead>
			<tbody>
			<?php
			$passengers=$ticket_xml->xpath('//PAX');
			foreach($passengers as $passenger) {?>
				<tr>
					<td align="left"><?php echo $passenger->TITLE;?></td>
					<td align="left"><?php echo $passenger->FIRSTNAME ;?></td>
					<td align="left"><?php echo $passenger->LASTNAME;?></td>
				</tr>
				<?php }?>
			</tbody>
		</table>
		</div>
		</div><br><br>
    
         <div id="passengers" class="showBox">
		<h5><?php echo $this->lang->line('ticket_number');?></h5><br>
		<table class="passengers">
			<tbody>
			<?php
			$passengers=$ticket_xml->xpath('//TICKETNUMBERS');
			foreach($passengers as $passenger) {?>
				<tr>
					<td align="center"><?php echo $passenger->TICKETNO;?></td>
				</tr>
				<?php }?>
			</tbody>
		</table>
		</div>
		<br><br>
		
        <div id="itinirary" class="showBox">
		<h5><?php echo $this->lang->line('itinirary');?></h5><br>
		<div style="margin-left: -14px; padding-top:6px;">
		<table class="tb_available" style="width:675px;">
			<thead>
			</thead>
			<tbody>
				<tr>
					<td class="miniTable"><?php echo $this->lang->line('from');?></td>
					<td class="miniTable"><?php echo $this->lang->line('to');?></td>
					<td class="miniTable"><?php echo $this->lang->line('flight');?></td>
					<td class="miniTable"><?php echo $this->lang->line('class');?></td>
					<td class="miniTable"><?php echo $this->lang->line('date');?></td>
					<td class="miniTable"><?php echo $this->lang->line('take_off');?></td>
					<td class="miniTable"><?php echo $this->lang->line('status');?></td>
					<td class="miniTable"><?php echo $this->lang->line('farebasis');?></td>
					<td class="miniTable"><?php echo $this->lang->line('baggage');?></td>
					<td class="miniTable"><?php echo $this->lang->line('cpn');?></td>
				</tr>
			<?php
			$segments = $ticket_xml->xpath('//FLIGHT');
			foreach($segments as $segment) {?>
				<tr>
					<td class="miniTable2"><?php echo $segment->FROM;?></td>
					<td class="miniTable2"><?php echo $segment->TO;?></td>
					<td class="miniTable2"><?php echo $segment->CARRIER.$segment->FLIGHTNO;?></td>
					<td class="miniTable2"><?php echo $segment->CLASS;?></td>
					<td class="miniTable2"><?php echo $segment->DATE;?></td>
					<td class="miniTable2"><?php echo $segment->TIME;?></td>
					<td class="miniTable2"><?php echo $segment->STATUS;?></td>
					<td class="miniTable2"><?php echo $segment->FAREBASIS;?></td>
					<td class="miniTable2"><?php echo $segment->BAGGAGE;?></td>
					<td class="miniTable2"><?php echo $segment->CPN;?></td>
				</tr>
				<?php }?>
			</tbody>
		</table></div>
		</div>
 <?php }  
	} ?>
</div>
</div>